home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Visual Basic 6.0 Utilities / Multi-Language Add-In for Visual Basic 6.0 / MultiLang.msi / _AF3F815C4EF811D5BEBE0020182C1E5C < prev    next >
Encoding:
Text File  |  2001-05-20  |  1.6 KB  |  45 lines

  1. Attribute VB_Name = "MlStringModule"
  2. Option Explicit
  3.  
  4. Public ml_CurrentLanguageId As Long
  5. Public Const ml_LanguageCount As Long = 0
  6.  
  7. Public Function ml_string(ByVal StringID As Long, Optional ByVal Text As String = "") As String
  8.   ml_string = Text
  9. End Function
  10.  
  11. Public Function ml_LanguageName(ByVal LangIndex As Long) As String
  12.   ml_LanguageName = "Invalid Language Index"
  13. End Function
  14.  
  15. Public Sub ml_ChangeLanguage(ByVal LanguageID As Long, ByVal Language As String)
  16.   
  17.   'If an application uses UserControls or Class Modules compiled as separate
  18.   'projects, then these projects may (a) not support the same languages or
  19.   '(b) not use the same ID number for a given language.
  20.   'If the language is changed at run time, an event can be fired via the
  21.   'MLSupport object, and received in all projects.
  22.   'This function checks whether the ID and Language name match before accepting
  23.   'the language change. If they do not match, then it searches for language
  24.   'using the language name not the ID. If the language is not found, then the
  25.   'language is not changed.
  26.   
  27.   'Check whether the LanguageID and the Language match in this project.
  28.   'Use StrComp() for case insensitive comparison
  29.   If StrComp(ml_LanguageName(LanguageID), Language, vbTextCompare) = 0 Then
  30.     ml_CurrentLanguageId = LanguageID
  31.   Else
  32.     'LanguageID may be different in this project.
  33.     'Search for the language string.
  34.     For LanguageID = 0 To ml_LanguageCount - 1
  35.       If StrComp(ml_LanguageName(LanguageID), Language, vbTextCompare) = 0 Then
  36.         ml_CurrentLanguageId = LanguageID
  37.         Exit For
  38.       End If
  39.     Next
  40.   End If
  41.   
  42. End Sub
  43.  
  44.  
  45.